package com.framework.modules.live.service.impl;

import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.framework.common.utils.PageUtils;
import com.framework.common.utils.Query;

import com.framework.modules.live.dao.LiveHistoryDao;
import com.framework.modules.live.entity.LiveHistoryEntity;
import com.framework.modules.live.service.LiveHistoryService;


@Service("liveHistoryService")
public class LiveHistoryServiceImpl extends ServiceImpl<LiveHistoryDao, LiveHistoryEntity> implements LiveHistoryService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<LiveHistoryEntity> page = this.selectPage(
                new Query<LiveHistoryEntity>(params).getPage(),
                new EntityWrapper<LiveHistoryEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<Map<String, Object>> getStatLiveHistory(Integer uid) {
        return this.baseMapper.getStatLiveHistory(uid);
    }

    @Override
    public PageUtils queryLiveHistory(Map<String, Object> params) {
        Page page=new Page(Integer.parseInt(params.get("page").toString()),Integer.parseInt(params.get("limit").toString()));
        return new PageUtils(page.setRecords(this.baseMapper.queryLiveHistory(page,params)));
    }

}
